package cn.com.dycc.task_manage.orderdeal.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import cn.com.dycc.task_manage.orderdeal.entity.NewFindOrderDeal;
import cn.com.dycc.task_manage.orderdeal.entity.OrderDealEntity;
import cn.com.dycc.task_manage.orderdeal.param.FindOrdealineParam;
import cn.com.dycc.task_manage.orderdeal.param.NewOrderDealParam;
import cn.com.dycc.task_manage.orderdeal.param.OrderDealParam;
import cn.com.dycc.task_manage.orderdeal.param.UpdateOrderParam;
import cn.com.dycc.task_manage.ordermain.entity.WorkOrdealInfor;


/**
 * 工单从表持久层
 * @author linfa
 *
 */
@Repository("orderDealDao")
public interface OrderDealDao {
	
	/**
	 * 发送工单待办从表
	 * @param orderDealParam
	 * @return
	 */
	public int recOrderDeal(OrderDealParam orderDealParam);
	
	/**
	 * 批量插入
	 * @param listOrderDealParam
	 * @return
	 */
	public int batchOrderDeal(List<OrderDealParam> listOrderDealParam);
	
	/**
	 * 查询工单细表信息
	 * @param findOrdealineParam
	 * @return
	 */
	public List<WorkOrdealInfor> findOrDealByUserId(FindOrdealineParam findOrdealineParam);
	
	/**
	 * 查询工单细表信息 统计
	 * @param findOrdealineParam
	 * @return
	 */
	public String findOrDealByUserIdCount(FindOrdealineParam findOrdealineParam);
	
	/**
	 * 查询工未处理单细表信息
	 * @param findOrdealineParam
	 * @return
	 */
	public List<WorkOrdealInfor> findOrDealNotByUserId(FindOrdealineParam findOrdealineParam);
	
	/**
	 * 查询工单未处理细表信息 统计
	 * @param findOrdealineParam
	 * @return
	 */
	public String findOrNotDealByUserIdCount(FindOrdealineParam findOrdealineParam);
	
	/**
	 * 根据order_id查询工单从表信息
	 * @param order_id
	 * @return
	 */
	public List<OrderDealEntity> findOrdealByOrderId(
			@Param("order_id")String order_id,
			@Param("org_id")String org_id);
	
	/**
	 * 处理工单并且发送给下一节点
	 * @param updateOrderParam
	 * @return
	 */
	public int updateOrderDeal(UpdateOrderParam updateOrderParam);
	
	/**
	 *  根据id查询节点是否已被处理  防止双开页面处理冲突
	 * @param serial_no
	 * @return
	 */
	public String findOrderStatusById(
			@Param("serial_no")String serial_no,
			@Param("org_id")String org_id);
	
	/**
	 * 根据父节点查询所有的子节点状态
	 * @param deal_pid
	 * @return
	 */
	public List<String> findOrderStatusByDealPid(
			@Param("deal_pid")String deal_pid,
			@Param("org_id")String org_id);
	
	/**
	 * 根据order_id查询所有的处理节点状态
	 * @param order_id
	 * @return
	 */
	public List<String> findOrderStatusByOrderId(
			@Param("order_id")String order_id,
			@Param("org_id")String org_id);
	
	/**
	 * 查询已处理的工单信息2018-07-25新起接口
	 * @param newOrderDealParam
	 * @return
	 */
	public List<NewFindOrderDeal> newFindOrderDeal(NewOrderDealParam newOrderDealParam);
	
	/**
	 * 查询已处理的工单信息2018-07-25新起接口 统计
	 * @param newOrderDealParam
	 * @return
	 */
	public String newFindOrderDealCount(NewOrderDealParam newOrderDealParam);

}
